package com.aaa.system.controller;

import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @program: aaa-education-parent
 * @description:
 * @author: 闫克起2
 * @create: 2024-03-07 11:56
 **/
@RestController
@RequestMapping("/system/")
public class LogoutController {
    @Autowired
    private StringRedisTemplate redisTemplate;
    @PostMapping("/logout")
    public Result logout(HttpServletRequest request){
        String token = request.getHeader("token");
        redisTemplate.delete(token);
        return new Result(2000,"退出成功",null);
    }
}
